﻿/////////////////////////////////////////////////////////////////
//
// Silverlight 5: 3D Physics using Balder and Jiglibx
// by Andy Beaulieu - http://www.andybeaulieu.com
//
// LICENSE: This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ANY 
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS
// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
/////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Xna.Framework;
using System.Windows.Media.Imaging;

namespace Spritehand.Physics3D
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            heightMap1.HeightInput += new EventHandler<Balder.Objects.Geometries.HeightmapEventArgs>(_game.Heightmap_HeightInput);
            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
            this.KeyDown += new KeyEventHandler(MainPage_KeyDown);
            this.KeyUp += new KeyEventHandler(MainPage_KeyUp);
        }

        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            // force focus so we can get keyboard input.
            System.Windows.Browser.HtmlPage.Plugin.Focus();
        }

        void MainPage_KeyDown(object sender, KeyEventArgs e)
        {
            InputManager.HandleKey(e.Key, true);
        }

        void MainPage_KeyUp(object sender, KeyEventArgs e)
        {
            InputManager.HandleKey(e.Key, false);
        }

       
        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            
        }

        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            if ((sender as RadioButton).Tag == null) return;

            int indexTag = Convert.ToInt32((sender as RadioButton).Tag);
            _game.ProjectileSelected = (MyGame.ProjectileType)indexTag;
        }


    }
}
